/**
 * TOPCODER SRM 518 Division II Level 2 (500 points)
 * http://community.topcoder.com/stat?c=problem_statement&pm=11471&rd=14543
 */

package topcoder;

public class LargestSubsequence {

	private String _getLargest(String s, int i, String r){
		if(i == s.length())
			return r;
		
		char c = 0;
		int j = i;
		
		for(; i<s.length(); i++){
			if(s.charAt(i) > c){
				c = s.charAt(i);
				j=i;
			}
		}
		
		return _getLargest(s, j+1, r+c);
	}
	
	public String getLargest(String s){
		return _getLargest(s, 0, "");
	}
}
